<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>日志</title>
    <link rel="stylesheet" href="../../../base/plugins/layui/css/layui.css" media="all" />
</head>
<body>
			<blockquote class="site-text layui-elem-quote">
			<h3>登录日志</h3>
		</blockquote>
			<div class="layui-col-md7">
			<div class="layui-form-item">
					<label class="layui-form-label">账号：</label>
					<div class="layui-input-inline">
						<input type="text" name="password"  placeholder="请输入账号" autocomplete="off" class="layui-input">
					</div>
					
					<label class="layui-form-label">姓名：</label>
					<div class="layui-input-inline">
						<input type="text" name="password"  placeholder="请输入姓名" autocomplete="off" class="layui-input">
					</div>
					<button class="layui-btn">搜索</button>
				</div>
			</div>
			<hr>
			</div>

  
			  <div class="layui-row">
			  	<form class="layui-form">
			  	<table class="layui-table">
			  		 <colgroup>
   						 <col width="90">
    					 <col width="160">
  						 <col>
  						 <col width="350">
    					 <col width="200">
  						 <col>
  						 <col width="280">
    					 <col width="300"> 						
 					</colgroup>
 					
 					<thead>
			  		<tr>
			  			
						<th>账号</th>
						<th>IP</th>
						<th>登录时间</th>
						<th>登录类型</th>
						<th>状态</th>
						<th>手机/浏览器</th>
						<th>Email</th>
					</tr>
					</thead>
					
					<tbody id="tbody">
				<!--	<tr>	
						<td>zhangsan</td>
						<td>127.0.0.1</td>
						<td>2018-08-29 09:13:26</td>
						<td>pc</td>
						<td>登录成功</td>
						<td>
							Mozilla/5.0 (Windows NT 10.0; WOW64; rv:61.0) Gecko/20100101 Firefox/61.0
						</td>
						<td>
						</td>
					</tr>
			  		
			  		<tr>	
						<td>zhangsan</td>
						<td>127.0.0.1</td>
						<td>2018-08-29 09:13:26</td>
						<td>pc</td>
						<td>登录成功</td>
						<td>
							Mozilla/5.0 (Windows NT 10.0; WOW64; rv:61.0) Gecko/20100101 Firefox/61.0
						</td>
						<td>
						</td>
					</tr>
					
					<tr>	
						<td>zhangsan</td>
						<td>127.0.0.1</td>
						<td>2018-08-29 09:13:26</td>
						<td>pc</td>
						<td>登录成功</td>
						<td>
							Mozilla/5.0 (Windows NT 10.0; WOW64; rv:61.0) Gecko/20100101 Firefox/61.0
						</td>
						<td>
						</td>
					</tr>
					
					<tr>	
						<td>zhangsan</td>
						<td>127.0.0.1</td>
						<td>2018-08-29 09:13:26</td>
						<td>pc</td>
						<td>登录成功</td>
						<td>
							Mozilla/5.0 (Windows NT 10.0; WOW64; rv:61.0) Gecko/20100101 Firefox/61.0
						</td>
						<td>
						</td>
					</tr>
					
				<tr>	
						<td>zhangsan</td>
						<td>127.0.0.1</td>
						<td>2018-08-29 09:13:26</td>
						<td>pc</td>
						<td>登录成功</td>
						<td>
							Mozilla/5.0 (Windows NT 10.0; WOW64; rv:61.0) Gecko/20100101 Firefox/61.0
						</td>
						<td>
						</td>
					</tr>
					
					<tr>	
						<td>zhangsan</td>
						<td>127.0.0.1</td>
						<td>2018-08-29 09:13:26</td>
						<td>pc</td>
						<td>登录成功</td>
						<td>
							Mozilla/5.0 (Windows NT 10.0; WOW64; rv:61.0) Gecko/20100101 Firefox/61.0
						</td>
						<td>
						</td>
					</tr>
					
					<tr>	
						<td>zhangsan</td>
						<td>127.0.0.1</td>
						<td>2018-08-29 09:13:26</td>
						<td>pc</td>
						<td>登录成功</td>
						<td>
							Mozilla/5.0 (Windows NT 10.0; WOW64; rv:61.0) Gecko/20100101 Firefox/61.0
						</td>
						<td>
						</td>
					</tr>
					
					<tr>	
						<td>zhangsan</td>
						<td>127.0.0.1</td>
						<td>2018-08-29 09:13:26</td>
						<td>pc</td>
						<td>登录成功</td>
						<td>
							Mozilla/5.0 (Windows NT 10.0; WOW64; rv:61.0) Gecko/20100101 Firefox/61.0
						</td>
						<td>
						</td>
					</tr>
					
					<tr>	
						<td>zhangsan</td>
						<td>127.0.0.1</td>
						<td>2018-08-29 09:13:26</td>
						<td>pc</td>
						<td>登录成功</td>
						<td>
								Mozilla/5.0 (Windows NT 10.0; WOW64; rv:61.0) Gecko/20100101 Firefox/61.0
						</td>
						<td>
						</td>
					</tr>
					
					<tr>	
						<td>zhangsan</td>
						<td>127.0.0.1</td>
						<td>2018-08-29 09:13:26</td>
						<td>pc</td>
						<td>登录成功</td>
						<td>
							Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
						</td>
						<td>
						</td>
					</tr>
			
					<tr>	
						<td>zhangsan</td>
						<td>127.0.0.1</td>
						<td>2018-08-29 09:13:26</td>
						<td>pc</td>
						<td>登录成功</td>
						<td>
							Mozilla/5.0 (Windows NT 10.0; WOW64; rv:61.0) Gecko/20100101 Firefox/61.0
						</td>
						<td>
						</td>
					</tr>-->
			
					</tbody>
			  	</table>
			  	</form>
			  </div>
			<script src="../../../base/js/jquery-1.11.3.min.js"></script>
			<script src="../../../base/plugins/layui/layui.js"></script>
		<script type="text/javascript">
		layui.use(['form','element'], function(){
				var form = layui.form;
				form.render();
				var element = layui.element;
				
				select();
				function select(){
					$.ajax({
						type:"post",//前端往后台发送的请求
						url:"http://win.z913953534.wang/studentDemo/demo/findPageData?%20page=1&rows=10",//请求的接口路径
						async:true,//表明ajax是一个同步请求false还是一个异步请求true
						dataType:"json",
						//ajax执行成功才会回调函数
						"success":function(result){
						//result为ajax响应的数据
						console.log(result.data.list);
						var list = result.data.list;
							for(var i = 0;i<list.length;i++) {
								var tr = $("<tr></tr>");
							
								var checkboxTd = $("<td></td>").append("<input type='checkbox' lay-skin='primary'>").addClass("children");
								//添加了一个参数attr  和一个类样式addClass
								var td1 = $("<td></td>").append(list[i].user_account);
								var td2 = $("<td></td>").append(list[i].request_ip);
								var td3 = $("<td></td>").append(list[i].login_date);
								if(list[i].type==0){
									var td4 = $("<td></td>").append("PC");
								}else{
									var td4 = $("<td></td>").append("Android");
								}
								if(list[i].state==0){
									var td5 = $("<td></td>").append("登录成功");
								}else{
									var td5 = $("<td></td>").append("登录失败");
								}
								var td6 = $("<td></td>").append(list[i].model_number);
								var td7 = $("<td></td>").append(list[i].imei);
								tr.append(checkboxTd).append(td1).append(td2).append(td3).append(td4).append(td5).append(td6).append(td7).appendTo($("#tbody"));
								form.render();
							};
						},
						"error":function(){
							layer.confirm("服务器崩溃了，请重新启动页面",{
								icon:2
							})
						}
					});
				}
			});
		</script>
</body>
</html>